#!/bin/sh

if [ $(hostname) =  "HONEYWELL" ] || [ $(hostname) = "freescale" ]
then 
	isPanel=1
	baseFolder=/mnt/
else
	isPanel=0
	baseFolder=.
fi

sourceFolder=/mnt/NetAXSDebugShell
destiFolder=192.168.1.36:/home/ubuntu/WorkStation/Temp/JOHNNYGOOGLE/project-johnny/bak/SetupUbuntuEvn/ShellScripts/NetAXS
exitFolder=/mnt/nfs
exitFolder2=/mnt


function clear
{
	if [ -d $exitFolder ]
	then 
		cd $exitFolder
	else
		cd $exitFolder2
	fi
	if [ -d $sourceFolder ]
	then
		echo "clear folder $sourceFolder"
		umount $sourceFolder
		rmdir $sourceFolder
	fi
	if [ -f $baseFolder ]
	then
		rm $baseFolder/$0
	fi
	pwd
}

echo -e "--mounting $sourceFolder --> $destiFolder----"
if [ "$1" = "clear" ]
then
	clear;
else
	if [ ! -d $sourceFolder ]
	then
		echo "create folder $sourceFolder"
		mkdir $sourceFolder
	fi
	echo "cp $0 $baseFolder"
	cp $0  $baseFolder
	mount -t nfs -o nolock $destiFolder $sourceFolder 
	cd $sourceFolder
	pwd
fi
